package com.zxjbyte.yiyi.framework.redis.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @Author zhangxingjia
 * @Date 2023/4/14 16:45
 * @Version: 1.0
 */
@Getter
@Setter
@ConfigurationProperties(RedisProperties.REDIS_PROP_PREFIX)
public class RedisProperties {

    public static final String REDIS_PROP_PREFIX = "yiyi.redis";

    // redis分布式锁全局配置
    private RLookProperties redisLock = new RLookProperties();

    @Getter
    @Setter
    public static class RLookProperties{
        /**
         * 获取锁时最多等待的时间 单位：毫秒
         */
        private Long waitTime = 3000L;

        /**
         * 锁的最大持有时间 单位：毫秒
         */
        private Long leaseTime = 20000L;

        /**
         * 获取锁失败时重试时间间隔 单位：毫秒
         */
        private Long retryInterval = 100L;
    }
}
